package com.zjx.springcloud.controller;

import com.alibaba.fastjson.JSONObject;
import com.zjx.springcloud.entities.ResponseData;
import com.zjx.springcloud.entities.ResultVO;
import com.zjx.springcloud.entities.test.Test;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.List;
@SuppressWarnings("all")
@RestController
public class DeptController_Consumer {

  //  public static final String REST_URL_PREFIX="http://localhost:8001";
    public static final String REST_URL_PREFIX="http://CLOUD-DEPT";

    @Resource
   private RestTemplate restTemplate;
    @Resource
    private DiscoveryClient client;
    /**
     * @api {post,get} /consumer/dept/add   添加User的接口
     * @apiName 添加用户
     * @apiGroup user
     * @apiDescription 添加用户的接口
     * @apiParam (Integer) userId 用户id
     * @apiParam (string) username 用户名
     * @apiParam (string) password 用户名密码
     *  @apiSuccessExample {json} 正确返回值:
     *  *     {
     *  *   "code": 0,
     *  *   "msg": "OK ",
     *  *   "data": [
     *  *       {
     *  *           "id": "622051004185471233",
     *  *           "testCode": "000050",s
     *  *       }
     *  *   ],
     *  *   "status": "ok",
     *  *   "count": "14"
     *  *   }
     * @apiSuccess (200) status 成功
     * @apiError (500) status 错误s
     * @apiError (501) status 错误
     */
    @RequestMapping(value = "/consumer/dept/queryAll",method = {RequestMethod.GET,RequestMethod.POST})
    public ResultVO queryAlls(Test dept) {

            return  restTemplate.postForObject(REST_URL_PREFIX+"/dept/queryAll",dept,ResultVO.class);
    }
}
